<?php
/*
 * wap 2.0 特卖会 产品 详情
 */

if (!defined('IN_SEXMALL')){
	die('Hacking attempt');
}


$cache_id = sprintf('%X', crc32(__FILE__));

if (!$smarty->is_cached('product_index.dwt', $cache_id))
{
	$brand_id		= empty($_GET['brand_id']) ? 0 : intval($_GET['brand_id']);
	$cat_id 		= wap_getcookie("WAP[cat_id]") ? wap_getcookie("WAP[cat_id]") : 0;
	$sort 			= wap_getcookie("WAP[sort]") ? wap_getcookie("WAP[sort]") : 0;
	$filter_stock 	= wap_getcookie("WAP[filter_stock]") ? wap_getcookie("WAP[filter_stock]") : 0;
	$show 			= wap_getcookie("WAP[show]") ? wap_getcookie("WAP[show]") : 0;


	/* 获得商品详细信息 */
	$productInfo = $productSku = array();

	$productInfo = get_product_info($product_id);


	// 如果没有找到任何记录则跳回到商品列表
	/*if (empty($productInfo))
	 {
		$back_url_params = array(
			 'm'				=> 'brand',
			 'act'			=> 'index',
			 'brand_id'		=> $brand_id,
			 'cat_id'		=> $cat_id,
			 'sort'			=> $sort,
			 'filter_stock'	=> $filter_stock,
			 'show'			=> $show
		);


		wap_header("Location: index.php?" . http_build_query($back_url_params));
	}*/

	require include_model_file($model . '_' . $action . '_' . $act);


	/* 获得品牌信息 */
	//$brand = get_brand($productInfo['brand_id']);

	/* 品牌分类 */
	//$catInfo = get_brand_category($productInfo['brand_id'], $productInfo['cat_id']);
	//$productInfo['cat_name'] = $catInfo['cur_cat']['cat_name'];


	//$productInfo['size_table_html'] = htmlspecialchars_decode($productInfo['size_table_html']);


	$back['name'] 			= str_replace($filterStr, '', $brand['brand_name']);
	$back['brand_id'] 		= $brand['brand_id'];
	$back['cat_id'] 		= $cat_id;
	$back['sort'] 			= $sort;
	$back['filter_stock'] 	= $filter_stock;
	$back['show'] 			= $show;

	$smarty->assign('brand',		$brand);
	$smarty->assign('product',		$productInfo);
	$smarty->assign('productSku',	$productSku);
	$smarty->assign('selectedSku',	$selectedSku);

	$smarty->assign('product_id',	$product_id);

	$smarty->assign('act',			$act);
	$smarty->assign('back',			$back);

	$smarty->assign('title', 		'');
	$smarty->assign('seo_keywords', '');
	$smarty->assign('seo_description', '');

}

$smarty->display('product_index.dwt');